package system.util;

import java.awt.image.BufferedImage;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

import javax.imageio.ImageIO;

public class ReportUtil
{
	public static void createReport(ArrayList<String> textItems, ArrayList<BufferedImage> resultImages, String reportFileFolder)
	{
		try {
			PdfUtil.textToPDF(textItems, resultImages, reportFileFolder + ".pdf");
			System.out.print("SIZE" + resultImages.size());
			for (int i = 0; i < resultImages.size(); i++) {
				File outputImageFile = new File(reportFileFolder + "_" + i + ".png");
				ImageIO.write(resultImages.get(i), "png", outputImageFile);
			}

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void saveImage(BufferedImage resultImage, String reportFileFolder)
	{
		try {
			File outputImageFile = new File(reportFileFolder + ".png");
			ImageIO.write(resultImage, "png", outputImageFile);

		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
